//
//  SecondViewController.m
//  NotificationDemo
//
//  Created by UniHan_iMac on 17/3/28.
//  Copyright © 2017年 UniHan_iMac. All rights reserved.
//

#import "SecondViewController.h"
#import "ThirdViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // 注册监听者
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangeBackColor:) name:@"ChangeColor" object:nil];
}

- (void)ChangeBackColor:(NSNotification *)notification{
    // 改变背景颜色
    self.view.backgroundColor = [[notification userInfo] objectForKey:@"color"];
}

- (IBAction)GoThird:(id)sender {
    ThirdViewController *thirdVC = [[ThirdViewController alloc] init];
    [self.navigationController pushViewController:thirdVC animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
